<template>
  <div>
    <basic-container>
       <avue-data-box :option="option"></avue-data-box>
    </basic-container>
   
  </div>
</template>

<script>
  import {mapGetters} from "vuex";
  import {getAction, putAction} from '@/api/manage'
  export default {
    name: "wel",
    data() {
      let _this = this
      return {
        option: {
          span:6,
          data: [
            {
              title: '待办流程',
              count: 0,
              icon: 'el-icon-warning',
              color: 'rgb(49, 180, 141)',
              click: function (item) {
                 _this.$router.push('/flowable/taskTodo')
              },
              target:'_blank'
            },
            {
              title: '已办流程',
              count: 33,
              icon: 'el-icon-view',
              color: 'rgb(56, 161, 242)',
              target:'_blank',
              click: function (item) {
                 _this.$router.push('/flowable/taskDone')
              },
            },
          ]
      },
      };
    },
    computed: {
      ...mapGetters(["userInfo"]),
    },
    created() {
       this.pageInit()
    },
    methods: {
      pageInit(){
         this.getTodoCou()
         this.getDoneCou()
      },
      handleChange(val) {
        console.log(val);
      },
      getTodoCou(){
         let _this = this
         getAction('/api/sdt-flow/flowable/task/todo-count').then(res=>{
             //debugger
             _this.option.data[0].count= res.data.data
             if(res.data.data>0){
                document.querySelectorAll('.el-submenu__title').forEach((item)=>{
                    if(item.innerText == '我的流程'){
                        item.classList.add('new')
                    }
                })
             }
         })
      },
      getDoneCou(){
         let _this = this
         getAction('/api/sdt-flow/flowable/task/done-count').then(res=>{
             //debugger
             _this.option.data[1].count= res.data.data
         })
      }
    
    }
  };
</script>

<style>
  .el-divider--horizontal {
    margin: 12px 0 !important;
  }

  .el-font-size {
    font-size: 14px;
  }
</style>

